package demo.dao;

import demo.po.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


import java.util.List;

public interface IUserMapper {
    @Select("select * from book")
    List<Book> findAll();

    @Insert("insert  into `book`(`bookname`,`author`,`publicationdate`,`price`) values (#{bookName},#{author},#{publicAtionDate},#{price})")
    void saveBook(Book book);

    @Delete("delete from book where author= #{author}")
    void deleteBook(String author);

    @Update("update book set bookName=#{bookName} where author=#{author}")
    void update(Book book);

    @Select("select * from book where author like concat('%',#{name},'%')")
    List<Book> findLike(String name);

    @Select("select count(id) from book")
    int countId();
}
